library ItemFibrinBandage initializer init requires LegacySystem

	private function FibrinBandageConditions takes nothing returns boolean
		local integer i = GetSpellAbilityId()
		return i=='AIh1' or i=='S001'
	endfunction

	private function FibrinBandage takes nothing returns nothing
		local integer i = 1
		local real burn
		local unit u
		if GetSpellAbilityId()=='S001' then //Marine Corpsman Cauterize
			set u = GetSpellTargetUnit()
			set burn = GetWidgetLife(u)-15.0
			if burn<0.0 then
				set burn = 0
			endif
			call SetWidgetLife(u,burn)
		else
			set u = GetTriggerUnit()
		endif
		call UnitRemoveAbility(u,'B00A')
		call UnitRemoveAbility(u,'B00A')
		set u = null
	endfunction

	private function init takes nothing returns nothing
		local trigger t
		set t = CreateTrigger()
		call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
		call TriggerAddCondition( t, Condition( function FibrinBandageConditions ) )
		call TriggerAddAction(t,function FibrinBandage)
	endfunction


endlibrary